home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Commun⁄Network / Telnet 2.5.src.ThinkC / source / environ.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-11-23  |  3.5 KB  |  129 lines  |  [TEXT/MPS ]

  1. /*
  2. *    environ.c:
  3. *     by Gaige B. Paulsen
  4. ****************************************************************************
  5. *    Part of NCSA Telnet for the Macintosh                                   *
  6. *                                                                          *
  7. *      Uses    :                                                               *
  8. *      TCP/IP kernel for NCSA Telnet                                       *
  9. *      by Tim Krauskopf                                                    *
  10. *       with Macintosh code by Gaige B. Paulsen                                 *
  11. *                                                                          *
  12. *      National Center for Supercomputing Applications                     *
  13. *      152 Computing Applications Building                                 *
  14. *      605 E. Springfield Ave.                                             *
  15. *      Champaign, IL  61820                                                *
  16. *                                                                          *
  17. *                                                                          *
  18. ****************************************************************************
  19. *
  20. *        Code to set up the environment variables.
  21. *
  22. *    Called by:
  23. *        maclook.c
  24. */
  25.  
  26.  
  27. #include <Stdio.h>
  28.  
  29. #include <Types.h>
  30. #include <OSUtils.h>
  31. #include <Script.h>
  32. #include <Errors.h>
  33.  
  34. #include "configrec.h"
  35. #include "maclook.h"
  36.  
  37. #define SYSENVIRON
  38. #define UnImplTrapNum 0x9f
  39. #define ScriptTrapNum 0xbf
  40. #define WNETrapNum 0x60
  41. #define SlotManagerNum 0x6E
  42.  
  43. #define CurrentVersion 1            /* Last known SysEnvirons version */
  44. #define HFSPtr ((long *)1014)
  45.  
  46. int Juggling;                            /* True if Multifinder is running */
  47. int ScriptManager;                        /* True if have scriptmanager */
  48. Boolean HFSflag;                        /* BYU LSC - True if HFS */
  49. int SlotManager;                        /* True if have slotmanager */
  50. int HasColor=0;                            /* True if have color quickdraw */
  51. long SysScriptKeys, SysScriptIcon;        /* The current script icon and keys */
  52. SysEnvRec theWorld;                        /* System Environment record */
  53.  
  54. int InquireEnvironment
  55.   (
  56.     void
  57.   )
  58. {
  59.     OSErr err;
  60.     long *HFSp=(long *)1014L;                /* I HATE LOW GLOBALS !!!! */
  61.  
  62.     HFSflag= (*HFSp) > 0L;                    /* BYU LSC */
  63.     if (HFSflag) putln("Under HFS");        /* BYU LSC - Check for HFS */
  64.         else putln("Under MFS");
  65.  
  66.     ScriptManager = GetTrapAddress(UnImplTrapNum) !=
  67.                     GetTrapAddress(ScriptTrapNum);
  68.     if (ScriptManager) {
  69.         SysScriptKeys= GetScript( smRoman, smScriptKeys);
  70.         SysScriptIcon= GetScript( smRoman, smScriptIcon);
  71.         }
  72.  
  73.     Juggling =    0;        /* BYU LSC - assume no multifinder */
  74.  
  75. #ifdef SYSENVIRON
  76.     err = SysEnvirons(CurrentVersion, &theWorld);
  77.     if (err == envVersTooBig) {
  78.         /* should post a message saying we need to be updated */
  79.         putln("SysEnvirons out of date!");
  80.     }
  81.     if (err != noErr)                /* possibly not available assume nothing here! */
  82.         return(0);
  83. #endif SYSENVIRON
  84.  
  85.     HasColor = theWorld.hasColorQD;
  86.  
  87. #ifdef NGETTRAP
  88.     Juggling =    NGetTrapAddress(WNETrapNum, ToolTrap) != 
  89.                 NGetTrapAddress(UnImplTrapNum, ToolTrap);
  90. #else
  91.     Juggling =    GetTrapAddress(WNETrapNum) != 
  92.                 GetTrapAddress(UnImplTrapNum);
  93. #endif
  94.     if (Juggling)
  95.         putln("Juggling!");        /* BYU */
  96.  
  97. #ifdef NGETTRAP
  98.     SlotManager =    NGetTrapAddress(SlotManagerNum, ToolTrap) != 
  99.                     NGetTrapAddress(UnImplTrapNum, ToolTrap);
  100. #endif
  101.     return(1);
  102. }
  103.  
  104. #ifdef AZTEC
  105. SysEnvirons( vreq, p)
  106. int vreq;
  107. SysEnvRec *p;
  108. {
  109.  
  110.     if (GetTrapAddress( 0xA090) == GetTrapAddress( UnImplTrapNum)) {
  111.         putln("No sysenvirons...");
  112.         return(-1);
  113.         }
  114.  
  115.     putln("Going In....");
  116.     if (0 == SECall( vreq, p)) {
  117.         putln("No Error");
  118.         return(0);
  119.         }
  120.     else return(-1);
  121. }
  122.  
  123. #asm
  124. _SECall    move.w    4(sp),d0
  125.         movea.l    6(sp),a0
  126.         dc.w    $a090
  127.         rts
  128. #endasm
  129. #endif AZTEC